<?php
/**
 * Created By Project
 * Author: 陈东
 * Copyright：陈东
 * Source Code：陈东
 * Explain：I shall not authorize for any other commercial purposes, law breakers must be prosecuted.
 */
namespace Home\Widget;
use Think\Controller;
class WxuserinfoWidget extends Controller {
	
	/*
	 * 根据用户token获取用户信息
	 */
	public function getuserinfo($token,$filed){
		echo $this->getuserinfos($token, $filed);	
	}
	
	public function getuserinfos($token,$filed){
		if(!empty($token)){
			$inforesult = file_get_contents('http://api.hrtv.cn/account/getuserinfo?token='.$token);
			//dump(json_decode($inforesult)->data);
			if(json_decode($inforesult)->ret==1){
				foreach (json_decode($inforesult)->data as $k=>$v){
					if($filed==$k){
						$r = $r.$v;
					}
				}
				return $r;
			}
				
		}else{
			return "-";
		}
	}

	
}
?>